﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="MyProjects.aspx.cs" Inherits="MyProjects" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">

    <script src="static/js/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>

    <link href="static/js/css/redmond/jquery-ui-1.7.2.custom.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        $(document).ready(function() {

            $(".dialog").dialog({
                width: 460,
                modal: true,
                autoOpen: false,
                buttons: {
                    "Close": function() {
                        $(this).dialog("close");
                    }
                },
                open: function(type, data) {
                    $(this).parent().appendTo("form");
                }
            });

            $(".datepicker").datepicker({ dateFormat: 'M d, yy' });

        });
    </script>

    <style type="text/css">
        .ui-datepicker
        {
            z-index: 1003; /* must be > than popup editor (1002) */
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="Server">
    <div class="mbox">
        <h1>
            <a href="#">My Projects</a></h1>
        <div class="text">
            <table cellpadding="2" cellspacing="0" border="0" style="width: 100%">
                <tr>
                    <td colspan="2">
                        <h3 style="margin: 0">
                            Projects I am Managing</h3>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="gvProjectsManaged" runat="server" CellPadding="4" ForeColor="#333333"
                            GridLines="Vertical" AutoGenerateColumns="False" Width="100%">
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <a id="lnk" onclick="$('#<%=hdfItemCode.ClientID %>').val('<%# Eval("Project_Code") %>');$('#dialogManage').dialog('open');">
                                            Manage this</a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Project Details">
                                    <ItemTemplate>
                                        <strong>
                                            <%#Eval("Project_Title") %></strong>
                                        <br />
                                        <span>
                                            <%#Eval("Project_Desc")%></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Deadline" DataFormatString="{0:D}" HeaderText="Deadline" />
                            </Columns>
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                        <asp:HiddenField ID="hdfItemCode" runat="server" />
                        <asp:HiddenField ID="hdfItemType" runat="server" />
                        <div id="dialogManage" title="Assign Task" class="dialog">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                                <ContentTemplate>
                                    <table border="0">
                                        <tr>
                                            <td>
                                                Select User:
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:DropDownList ID="ddlUsers" runat="server">
                                                </asp:DropDownList>
                                                <asp:Button ID="btnBindUsers" runat="server" Text="Load Users" OnClick="btnBindUsers_Click" />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Task Title:
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:TextBox ID="txtTaskTitle" runat="server"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Task Description:
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:TextBox ID="txtTastDesc" runat="server" Height="100px" TextMode="MultiLine"
                                                    Width="250px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Start Date:
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:TextBox ID="txtTaskOpenDate" runat="server" CssClass="datepicker"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Deadline:
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:TextBox ID="txtTaskDeadline" runat="server" CssClass="datepicker"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblStatus" runat="server" ForeColor="Red" Visible="False" />
                                            </td>
                                            <td>
                                                &nbsp;
                                                <asp:Button ID="btnAddTask" runat="server" Text="Assign Task" OnClientClick="this.style.display='none';"
                                                    OnClick="btnAddTask_Click" />
                                                &nbsp;&nbsp;
                                            </td>
                                        </tr>
                                    </table>

                                    <script type="text/javascript">
                                        //load a handler to the Sys.Application
                                        Sys.Application.add_load(ApplicationLoadHandler);
                                        function ApplicationLoadHandler(sender, args) {
                                            //get the page Manager Object
                                            var prm1 = Sys.WebForms.PageRequestManager.getInstance();
                                            //verify state of postback
                                            if (!prm1.get_isInAsyncPostBack()) {
                                                prm1.add_endRequest(endRequest);
                                            }
                                        }
                                        function endRequest(sender, args) {
                                            $(".datepicker").datepicker({ dateFormat: 'M d, yy' });

                                        }
                                    </script>

                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <h3 style="margin: 0">
                            Projects I am working on</h3>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="gvProjectsOther" runat="server" CellPadding="4" ForeColor="#333333"
                            GridLines="Vertical" AutoGenerateColumns="False" Width="100%">
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <a href='ProjectTasks.aspx?pcode=<%#Eval("Project_Code") %>'>View Tasks</a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Project Details">
                                    <ItemTemplate>
                                        <strong>
                                            <%#Eval("Project_Title") %></strong>
                                        <br />
                                        <span>
                                            <%#Eval("Project_Desc")%></span>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Deadline" DataFormatString="{0:D}" HeaderText="Deadline" />
                            </Columns>
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:Label ID="lblMessage" runat="server" ForeColor="Red" Visible="False"></asp:Label>
                    </td>
                </tr>
            </table>
        </div>
        <div class="footer">
            <div class="bookmarks">
                <a href="Default.aspx">Go to Home</a>
            </div>
            <a href="Compose.aspx">Compose a Message</a> | <a href="UploadDocument.aspx">Upload
                a Documents</a>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cphSide" runat="Server">
</asp:Content>
